package com.example.demo.design_patterns.factory_method;

/**
 * @author: htc
 * @date: Created in 9:56 2019/3/13.
 */
public class Client {
    /**
     *  客户端代码只要将相应的参数传入即可得到对象
     *  用户不需要了解工厂类内部的逻辑
     */
    public void get(String name) {
        Food x = null;
        if (name.equals("A")){
            x =StaticFactory.getA();
        }
        if (name.equals("B")){
            x =StaticFactory.getB();
        }
        if (name.equals("C")){
            x =StaticFactory.getC();
        }
    }
}
